<?php

return [
    /*
     * The HTML <title> for the generated documentation, and the name of the generated Postman collection.
     */
    'title' => 'WP Lara Press API 接口文档',

    /*
     * A short description of your API.
     */
    'description' => 'WordPress Laravel Press 插件API - 提供强大的WordPress文章查询接口',

    /*
     * The base URL displayed in the docs.
     */
    'base_url' => null, // 将在运行时动态设置

    /*
     * Tell Scribe what routes you want to document.
     */
    'routes' => [
        [
            /*
             * The route groups to include.
             */
            'include' => [
                'api/*',
            ],

            /*
             * Exclude these route groups.
             */
            'exclude' => [
                // 'api/health',
            ],

            /*
             * Apply these middlewares when generating docs.
             */
            'apply' => [
                // 'auth:api',
            ],
        ],
    ],

    /*
     * Configure how responses are generated.
     */
    'responses' => [
        /*
         * Add a "Try It Out" button to the docs.
         */
        'try_it_out' => [
            'enabled' => true,
            'base_url' => env('APP_URL', 'http://localhost'),
        ],
    ],

    /*
     * How should we extract information about your API calls?
     * 重新启用安全的自动提取策略
     */
    'strategies' => [
        'metadata' => [
            \Knuckles\Scribe\Extracting\Strategies\Metadata\GetFromDocBlocks::class,
        ],
        'urlParameters' => [
            \Knuckles\Scribe\Extracting\Strategies\UrlParameters\GetFromLaravelAPI::class,
            \Knuckles\Scribe\Extracting\Strategies\UrlParameters\GetFromUrlParamTag::class,
        ],
        'queryParameters' => [
            \Knuckles\Scribe\Extracting\Strategies\QueryParameters\GetFromFormRequest::class,
            \Knuckles\Scribe\Extracting\Strategies\QueryParameters\GetFromInlineValidator::class,
            \Knuckles\Scribe\Extracting\Strategies\QueryParameters\GetFromQueryParamTag::class,
        ],
        'headers' => [
            \Knuckles\Scribe\Extracting\Strategies\Headers\GetFromHeaderTag::class,
        ],
        'bodyParameters' => [
            \Knuckles\Scribe\Extracting\Strategies\BodyParameters\GetFromFormRequest::class,
            \Knuckles\Scribe\Extracting\Strategies\BodyParameters\GetFromInlineValidator::class,
            \Knuckles\Scribe\Extracting\Strategies\BodyParameters\GetFromBodyParamTag::class,
        ],
        'responses' => [
            \Knuckles\Scribe\Extracting\Strategies\Responses\UseResponseTag::class,
            \Knuckles\Scribe\Extracting\Strategies\Responses\UseApiResourceTags::class,
            \Knuckles\Scribe\Extracting\Strategies\Responses\UseTransformerTags::class,
            // 禁用ResponseCalls以避免数据库连接问题
            // \Knuckles\Scribe\Extracting\Strategies\Responses\ResponseCalls::class,
        ],
    ],

    /*
     * 数据库配置 - 禁用数据库事务避免WordPress插件环境冲突
     */
    'database_connections_to_transact' => [],

    /*
     * The type of documentation output to generate.
     * - "static" will generate a static HTML page in the /public/docs folder,
     * - "laravel" will generate the documentation as a Blade view, so you can add routing and authentication.
     */
    'type' => 'laravel',

    /*
     * The theme to use for the generated documentation.
     * Supported options:
     * - "default" - Classic Scribe theme (current)
     * - "elements" - Modern theme based on Stoplight Elements
     */
    'theme' => 'elements', // 使用现代化的Elements主题

    /*
     * Settings for writing and generating the docs.
     */
    'static' => [
        /*
         * HTML documentation output path.
         */
        'output_path' => 'public/docs',
    ],

    /*
     * Settings for the example requests.
     */
    'example_requests' => [
        /*
         * Set the language for the example requests.
         */
        'languages' => [
            'bash' => [
                'name' => 'Bash',
                'sample' => file_get_contents(__DIR__ . '/../resources/docs/bash-example.md'),
            ],
            'javascript' => [
                'name' => 'JavaScript',
                'sample' => file_get_contents(__DIR__ . '/../resources/docs/js-example.md'),
            ],
            'php' => [
                'name' => 'PHP',
                'sample' => file_get_contents(__DIR__ . '/../resources/docs/php-example.md'),
            ],
        ],
    ],

    /*
     * Settings for Postman collection generation.
     */
    'postman' => [
        'enabled' => true,
        'overrides' => [
            // 'info.version' => '2.0.0',
        ],
    ],

    /*
     * Settings for OpenAPI spec generation.
     */
    'openapi' => [
        'enabled' => true,
        'overrides' => [
            // 'info.version' => '2.0.0',
        ],
    ],

    /*
     * Custom logo for your documentation.
     */
    'logo' => false,

    /*
     * If you would like the package to generate the same example values for parameters on each run,
     * set this to any number (eg. 1234)
     */
    'faker_seed' => 1234,

    /*
     * Custom text to place in the "Introduction" section.
     */
    'intro_text' => '
# WordPress Laravel Press API

这是一个集成在WordPress插件中的Laravel API，提供强大的文章查询功能。

## 认证

目前API不需要认证，所有端点都是公开的。

## 基础URL

所有API请求的基础URL是：`{base_url}/api`

## 响应格式

所有响应都遵循统一的JSON格式：

```json
{
  "code": 200,
  "message": "操作成功",
  "data": {
    // 实际数据
  }
}
```

## 错误处理

- `200`: 成功
- `422`: 请求参数验证失败
- `500`: 服务器内部错误
    ',
];
